#!/usr/bin/e    nv python
# coding: utf-8

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util

import module.crawl
import data.provider
import logging

class MainHandler(webapp.RequestHandler):
    def get(self):
        dic = data.provider.Providers().get_providers()
        for provider, value in dic.items():
            count = module.crawl.CrawlProducts.cralwer_social_data(provider, value[1], value[0])
            #logging.info(str(value[1]) + ": " + str(count))
            self.response.out.write(provider)
            self.response.out.write(count)
            self.response.out.write("<br>")
            
def main():
    application = webapp.WSGIApplication([('/crawler', MainHandler)],
                                         debug=True)
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()